package projects.android.sms.db;

/**
 * Interface holding constants which are used in the {@link DBHandle} class.
 * 
 * @author Thomas Jaeger
 * @author Mario Kraml
 * @author Tassilo Posegga
 * @author Robert Schenkenfelder
 * 
 */
public interface DBConstants {

	/**
	 * Enumeration identifying the different key types (private and public).
	 * 
	 * @author Thomas Jaeger
	 * @author Mario Kraml
	 * @author Tassilo Posegga
	 * @author Robert Schenkenfelder
	 * 
	 */
	enum KeyType {
		Private("private"), Public("public");

		private final String type;

		KeyType(String type) {
			this.type = type;
		}

		public String getType() {
			return type;
		}
	}

	// Database Version
	static final int DATABASE_VERSION = 1;

	// Database Name
	static final String DATABASE_NAME = "EncryptMySms3";

	static class SmsTable {
		public static final String TABLE_NAME = "SMS";

		public static final String ID = "id";
		public static final String MESSAGE = "message";
		public static final String NUMBER = "number";
		public static final String DATE = "date";
		public static final String INCOMING = "incoming";

		public static final String CREATE = "CREATE TABLE " + TABLE_NAME + "(" + ID + " INTEGER PRIMARY KEY," + MESSAGE
				+ " TEXT," + NUMBER + " TEXT," + DATE + " LONG, " + INCOMING + " INTEGER" + ")";
	}

	static class KeysTable {
		public static final String TABLE_NAME = "KEYS";

		public static final String ID = "id";
		public static final String NUMBER = "number";
		public static final String PUBLIC_EXPONENT = "exponent";
		public static final String MODULUS = "modulus";

		public static final String CREATE = "CREATE TABLE " + TABLE_NAME + "(" + ID + " INTEGER PRIMARY KEY," + NUMBER
				+ " TEXT," + PUBLIC_EXPONENT + " TEXT" + ", " + MODULUS + " TEXT)";
	}

	static class OwnKeyPairTable {
		public static final String TABLE_NAME = "OWN_KEY_PAIR";

		public static final String TYPE = "type";
		public static final String MODULUS = "modulus";
		public static final String PUBLIC_EXPONENT = "publicExponent";
		public static final String PRIVATE_EXPONENT = "privateExponent";
		public static final String PRIME_P = "primeP";
		public static final String PRIME_Q = "primeQ";
		public static final String PRIME_EXPONENT_P = "primeExponentP";
		public static final String PRIME_EXPONENT_Q = "primeExponentQ";
		public static final String CRT_COEFFICIENT = "crtCoefficient";

		public static final String CREATE = "CREATE TABLE " + TABLE_NAME + "(" + TYPE + " TEXT, " + MODULUS + " TEXT, "
				+ PUBLIC_EXPONENT + " TEXT," + PRIVATE_EXPONENT + " TEXT," + PRIME_P + " TEXT," + PRIME_Q + " TEXT,"
				+ PRIME_EXPONENT_P + " TEXT," + PRIME_EXPONENT_Q + " TEXT," + CRT_COEFFICIENT + " TEXT)";
	}
}
